package com.example.xiao.httpprocessor

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import com.example.xiao.httpprocessor.Bean.ResponseData
import com.example.xiao.httpprocessor.HttpProcessor.HttpCallback
import com.example.xiao.httpprocessor.HttpProcessor.HttpHelper
import com.example.xiao.httpprocessor.HttpProcessor.VolleyProcessor
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    var url = "http://www.mocky.io/v2/5c7a18b74900007e00a5a695"
    var params: HashMap<String,Any> = HashMap()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        text.setOnClickListener {
            HttpHelper.getInstance()!!.post(url,params,object : HttpCallback<ResponseData>(){
                override fun onSuccess(result: ResponseData) {
                    Toast.makeText(application,result.hello,Toast.LENGTH_LONG).show()
                }
            })
        }
    }
}
